package com.rd.student.ruanjian.class4.zhangrui.day8_1;

import java.util.Arrays;

public class ArrTest2 {
    public static void main(String[] args) {
        int[] arr1 = new int[]{1, 3, 5, 7, 9, 11, 13, 15, 17};
        //存在一个数组{1,3,5,7,9,13,15,17}，删除元素11，将后续元素依次前移，最后一位补0。
        int i = 0;
        for (; i < arr1.length; i++) {
            if (arr1[i] == 11) {
                arr1[i] = 0;
                break;
            }
        }
        int i1 = 0;
        for (int j = i; j < arr1.length-1; j++) {
            i1 = arr1[j];
            arr1[j] = arr1[j + 1];
            arr1[j + 1] = i1;

        }
        System.out.println(Arrays.toString(arr1));
    }
}
